UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vZ2RHNw8Q9JWgS+fYg0Zry3G2jWlQKOasbXz8hRYV10='
WHERE
key_id = '6b2f6ecc2f4f07451d5a90db167db020a4775b7430edda91db821caa46b8ed5e'
AND (
token = 'vZ2RHNw8Q9JWgS+fYg0Zry3G2jWlQKOasbXz8hRYV10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)