UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ad5s1ugkI7NCtB68MrE7PewymcO1LzLD7dP+MW3vEzc='
WHERE
key_id = 'b17b3e5307bd5ae928d7f84c9020bdb8020fbb6caf2c47e734093e523469be48'
AND (
token = 'Ad5s1ugkI7NCtB68MrE7PewymcO1LzLD7dP+MW3vEzc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)