UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rNL0qjXm2EuiqmFvfonOwg/GyYYwoH1PgdHuL4jIKCo='
WHERE
key_id = '7a5f331dbbd3b2bfd13830b3ed055b9e329bf3e89c8bbc50d93eb8baa39c8deb'
AND (
token = 'rNL0qjXm2EuiqmFvfonOwg/GyYYwoH1PgdHuL4jIKCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)