UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tgPWyx8Ogq6N4v7unnvJu8ijFoDSEkZ1IDjxHKG4EDw=' 
WHERE 
  key_id = '21ba3626965279fabd9dc9a2f8320fb7315444578bb844f71a83dc4f08f22772' 
  AND (
    token = 'tgPWyx8Ogq6N4v7unnvJu8ijFoDSEkZ1IDjxHKG4EDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032