UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XO1C5nabWC4JBEEHdkNKw1+8QSsVgMiExSR7pU93sKY=' 
WHERE 
  key_id = '757d4f10b789f0a53d4a96c30cc41e85e21d22911c6595406257ea5682a64048' 
  AND (
    token = 'XO1C5nabWC4JBEEHdkNKw1+8QSsVgMiExSR7pU93sKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028