UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6lMc/PgJnmgivVuvo7SMEG5gXXw7ENjfFLjfMYEOn6Y='
WHERE
key_id = 'd8e17c73d8756173fbebe9b6143433a1b820e8021851427440b2cb021f191ad7'
AND (
token = '6lMc/PgJnmgivVuvo7SMEG5gXXw7ENjfFLjfMYEOn6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)