UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ov7NIF23SeckYKQDUBomnfyizidq6NdTtxFCqss5qd8=' 
WHERE 
  key_id = '22ecf5907e8937c61bd2d01b42cb9fcae52f7f013f172052ecb41ecddb560543' 
  AND (
    token = 'ov7NIF23SeckYKQDUBomnfyizidq6NdTtxFCqss5qd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027