UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ihux1dvK3DPkRA/KXmeA8aKYzLeB+9HVzOpXpIFJRo=' 
WHERE 
  key_id = 'ec40c605ffba6f36abc1ccf6fc4b9fe7c4da1943ad38f478fb69e8e3d11435fa' 
  AND (
    token = '+ihux1dvK3DPkRA/KXmeA8aKYzLeB+9HVzOpXpIFJRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022