UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lrxNYyRDlBYYeJXtEe8099TWhGWUPCNGdtR791dlouU=' 
WHERE 
  key_id = '9a8f075484fb21e458b6779ab46239f9b2a450dcce731390030f37bee4536487' 
  AND (
    token = 'lrxNYyRDlBYYeJXtEe8099TWhGWUPCNGdtR791dlouU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016