UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AzINkbAV9V2agg7wpaz6xJi6qFcWEO1R67BlbqsjNr4='
WHERE
key_id = '4aed98d355fc2ad4a2061de384ff3414272ea0496114384dd0f6abc8458d963d'
AND (
token = 'AzINkbAV9V2agg7wpaz6xJi6qFcWEO1R67BlbqsjNr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)