UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2NKEMVn5CeQSSTYVzMUsaIz0WTlhR7heMoB7+95nkvU='
WHERE
key_id = 'aa5842987853ee263a8f0bd1c8f5768635e5116d282e2ca0279a44478a7a408b'
AND (
token = '2NKEMVn5CeQSSTYVzMUsaIz0WTlhR7heMoB7+95nkvU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)