UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uWRDrLn4hBKK/zX4L6iL90BU4JJvji0jkuInlVpv8dQ=' 
WHERE 
  key_id = '9b26aa43ccedee427e4db7e28baa4830917115362f96f896a8aa7b32758b143f' 
  AND (
    token = 'uWRDrLn4hBKK/zX4L6iL90BU4JJvji0jkuInlVpv8dQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030