UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1hmnM9E9T9IN/kVwSWizfIOMCH85/gFh47ZgTppD8YQ=' 
WHERE 
  key_id = '7a63d7d4fad5f1b9aa6e4b93f464b35cb83783922040941527beb315df1406da' 
  AND (
    token = '1hmnM9E9T9IN/kVwSWizfIOMCH85/gFh47ZgTppD8YQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017