UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wCkvKvpmYbMGvhStQEURyDuyVwFdHxa6P/0+fZSTlyM='
WHERE
key_id = 'b359fdcc1c19a10b52e9d0345e4780467a5e7252ab0c9f2caee04091233e9436'
AND (
token = 'wCkvKvpmYbMGvhStQEURyDuyVwFdHxa6P/0+fZSTlyM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)