UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tz/B7ar2S6M+pmCcXJWaVS5hMEWgxQhT4EzsTf9hgyA=' 
WHERE 
  key_id = '4f068b5e55efa55d15da21b96047d0f8d650f513ee16f9e33818d1ff7aed5002' 
  AND (
    token = 'Tz/B7ar2S6M+pmCcXJWaVS5hMEWgxQhT4EzsTf9hgyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027