UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'schcDQspd5t1CwtZtucdlqyf0eHEaVehhhn5yHk6ObE=' 
WHERE 
  key_id = '2b6def3e29195dd767bc7c457b9b3fc713c1aaf721400823925065a971dfbf89' 
  AND (
    token = 'schcDQspd5t1CwtZtucdlqyf0eHEaVehhhn5yHk6ObE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033