UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UYxavqxdbaBaqm1gv3+gYO/srkatwOpsvScvuFkGzfU=' 
WHERE 
  key_id = '87be9cee4899a814c8686a8ef4ac4e05905fe0e519f8d4a2bf7cac9c45e85100' 
  AND (
    token = 'UYxavqxdbaBaqm1gv3+gYO/srkatwOpsvScvuFkGzfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083