UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZyO0h2f98YfF/sAgEfwpeZDUMOb1O5TdwmwcgzjH9BQ=' 
WHERE 
  key_id = '8ef2d8541972e1b0d706dfa5d1fd27292baab14cfd398502db1eb0cc54118411' 
  AND (
    token = 'ZyO0h2f98YfF/sAgEfwpeZDUMOb1O5TdwmwcgzjH9BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025