UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YzSYwSPGG7gU4U0vcSTf32VVQmNX3c5TOsRCHsgyN18=' 
WHERE 
  key_id = '67039f6a51d183923f774a19390ec517d528e886dc6cea5b4c2b29e845c58e09' 
  AND (
    token = 'YzSYwSPGG7gU4U0vcSTf32VVQmNX3c5TOsRCHsgyN18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033