UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gktzck+emcQCCCTO9BHPNnotu9uhEFWPsYl+isgUR9w=' 
WHERE 
  key_id = '1cf5c16ac08bfa08e3ab935a8a0bcc0b1b07e4476975c3b9fc022885aa1abbeb' 
  AND (
    token = 'gktzck+emcQCCCTO9BHPNnotu9uhEFWPsYl+isgUR9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028