UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Az3a8Go2MjamFWOsayvfgTyjCyBNRHUzGN1fZKWLzHk=' 
WHERE 
  key_id = 'fcc99c986f75e3d422a85c61d29b1d5c3a2819870d24617e23181d763e23b768' 
  AND (
    token = 'Az3a8Go2MjamFWOsayvfgTyjCyBNRHUzGN1fZKWLzHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034