UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J0c4VRjmYEItdv5RAgb6K3jKOELDqOxzj5+wBeUkOx4=' 
WHERE 
  key_id = 'b9ed7b7322b272d21a7c56bd19f712ae1366d59f095a6b41b361616b31a181f1' 
  AND (
    token = 'J0c4VRjmYEItdv5RAgb6K3jKOELDqOxzj5+wBeUkOx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066