UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7boDrwMdfgyJ8A0E0BBzUbhMYHicY7ROx5sEJrTKRLI=' 
WHERE 
  key_id = '2985c251f25630f80eb9b9399077a19f7340765d6a3e067c93b3413cf6dbcfaa' 
  AND (
    token = '7boDrwMdfgyJ8A0E0BBzUbhMYHicY7ROx5sEJrTKRLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030