UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhbGQd09ausSL217XrXEdWWCPM0J8zpNrz0zq12TL+s=' 
WHERE 
  key_id = '37ec207e0afb94726a523175ab68355e4fcb3647cc5e62978209ce72defd157e' 
  AND (
    token = 'hhbGQd09ausSL217XrXEdWWCPM0J8zpNrz0zq12TL+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042