UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xw54kRHRlm0Oy2afSPrMEdUEutjCmTFwBRAnBpT83Es='
WHERE
key_id = 'f01f7d5ee5592bd9e7b41257b3701f5cbe82830cb671a88b5fff7cfff1151cce'
AND (
token = 'xw54kRHRlm0Oy2afSPrMEdUEutjCmTFwBRAnBpT83Es='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)