UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/gzjwftitsDc2r9uhctfZfQ6UHfCu7v+iQeSctxBXcs=' 
WHERE 
  key_id = '34dfb722d6820d014cb324cb79b98d5237e117f2fd5b34b4db3b85a16ccddd7e' 
  AND (
    token = '/gzjwftitsDc2r9uhctfZfQ6UHfCu7v+iQeSctxBXcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036