UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R+C2WzbVxEHFZyyoiiQsH+ztF19yqgh/Hc/gJgQ1gco=' 
WHERE 
  key_id = 'c163cf3301b1b945bed9c50d22fe95d2b4137a46754b3e3e5c80681157ca2342' 
  AND (
    token = 'R+C2WzbVxEHFZyyoiiQsH+ztF19yqgh/Hc/gJgQ1gco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036