UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X944INICYeKkF0YJsiW/ftBGL9Gb/RLxaDA24moERlQ='
WHERE
key_id = 'a5a9e6964fd45dbdade83452df45d5e38669e6f108a3150c877b376e79cf6d4b'
AND (
token = 'X944INICYeKkF0YJsiW/ftBGL9Gb/RLxaDA24moERlQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)