UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+ilGsrqPYZF8rV8ludEiPdVNrjNYB31bfHvgJMO69I0='
WHERE
key_id = '1546a5ab5a6855c8fba441f894f46b06e7323b1be645f439dc861bd49f02b9ae'
AND (
token = '+ilGsrqPYZF8rV8ludEiPdVNrjNYB31bfHvgJMO69I0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)