UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmT3yXbJ+DKadItJRim0QAU8WZ+ozXsBHoBmVESMGu8='
WHERE
key_id = 'b3b60d6e89c97c76854a5a1648c9b25afeed4f3634eb5db7b5c2382253712900'
AND (
token = 'tmT3yXbJ+DKadItJRim0QAU8WZ+ozXsBHoBmVESMGu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)