UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bI1B4dvpJezyQoWct8jVFRIdkPBgWjkZC70SNg+IjDc='
WHERE
key_id = 'e7ce63b47acbe2c375f825cc0ac128b737a6e4d8d8a0898a55014ab6bd1dc929'
AND (
token = 'bI1B4dvpJezyQoWct8jVFRIdkPBgWjkZC70SNg+IjDc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)