UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k46MiAdPdbNeFrWRqN0ncc9+KC4X0QYQ1cwXG5RsF+Q=' 
WHERE 
  key_id = '3f3890cd990e207d984c169735bc27e4c0eb440892934e6722f8934d90445c39' 
  AND (
    token = 'k46MiAdPdbNeFrWRqN0ncc9+KC4X0QYQ1cwXG5RsF+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056