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