UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ypaf3auRpoMR8jiG8yvoU9WNwyRCLeq5GrYmnaFCMd8='
WHERE
key_id = 'bd9d70c9519c88a04ebc8d952536a8b2a25e0380c1959056595b216b9db9a42d'
AND (
token = 'ypaf3auRpoMR8jiG8yvoU9WNwyRCLeq5GrYmnaFCMd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)