UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/PB4blaMv8XEm0vD0ghgOW1vnNlQi6LpBaLmoKCMfl0='
WHERE
key_id = 'c0389e34a63137a100dc2c4b65659c3c9e4b5bdbf90fbf2f9147beec491829f2'
AND (
token = '/PB4blaMv8XEm0vD0ghgOW1vnNlQi6LpBaLmoKCMfl0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)