UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NOJffSUsbjJsqvMiOdPLeAc1JOXTRMoB+qauJrvfsuQ='
WHERE
key_id = 'f64f69b29c81a9e0e0dd7a323a83314655709cc47f4bbd349707e8c10600aad7'
AND (
token = 'NOJffSUsbjJsqvMiOdPLeAc1JOXTRMoB+qauJrvfsuQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)