UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wsnztTNFeoe/8SwbSFyzOqPaGM3d2lq6C/rxxP1Cqo8='
WHERE
key_id = 'aaa7f4b08b565fc31c2384745a786ee9bae6ff09ca16597d45d217b6c345a097'
AND (
token = 'wsnztTNFeoe/8SwbSFyzOqPaGM3d2lq6C/rxxP1Cqo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)