UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XKUlcuJQKRgu6NpJOBNg1voI1DzEOkLMtPBjufbHnug=' 
WHERE 
  key_id = '0db4f1c8209d7afe26991b38b53bdaf2a33351516f25db26208c492a4a2abf36' 
  AND (
    token = 'XKUlcuJQKRgu6NpJOBNg1voI1DzEOkLMtPBjufbHnug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027