UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8fhPdq3dazZskDot+ItiiDMerSMtC6XkPwKCMeyscE='
WHERE
key_id = '9a45563d1eaffd54feeaa9f1fbbeb3d8eeeb2309a9a52505b479bc02146a9a8f'
AND (
token = 'N8fhPdq3dazZskDot+ItiiDMerSMtC6XkPwKCMeyscE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)