UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H7R23oa3mhXYwcS2FtZK+xBu/SUPZOK5mL8zUYzojDE=' 
WHERE 
  key_id = 'ec1598ad0c410ec52e37360845ca9da9dd346e238e0790edc12a4ce41f892827' 
  AND (
    token = 'H7R23oa3mhXYwcS2FtZK+xBu/SUPZOK5mL8zUYzojDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038