UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9J1INYKdyEzqxIUwp0RBw+JMMACfN1NJkPjL+cZj3jk='
WHERE
key_id = '51d6bb4b9643a24aceedde244f00c257320e7276f4765782cdf277e270681e6e'
AND (
token = '9J1INYKdyEzqxIUwp0RBw+JMMACfN1NJkPjL+cZj3jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)