UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hgsn8tJC4/Kh+X0FU+nTTysGxu9nMwrM22r7UDU+dRQ=' 
WHERE 
  key_id = '64845d7f646828fd72f4d5d032c3504cce4dec5dfff404f9bf3bcd4572a0fd6c' 
  AND (
    token = 'Hgsn8tJC4/Kh+X0FU+nTTysGxu9nMwrM22r7UDU+dRQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059