UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OFF7axRz47VnK1i1LuJ21dbpFyvbNsPuskHkhYB9KF4='
WHERE
key_id = '40bdd71a71b0deccb29ab1eab54f39d0be8669a5fc1afafb7b9627da6dd4b96b'
AND (
token = 'OFF7axRz47VnK1i1LuJ21dbpFyvbNsPuskHkhYB9KF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)