UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3IiFFPWbu80HRfY7kpBoPBXdCIf5v9OvwQGhatEsuFk='
WHERE
key_id = 'ed58e6b856b95b47376ec1ace828f91ba491aabd5cdcf96caa53069bf3686819'
AND (
token = '3IiFFPWbu80HRfY7kpBoPBXdCIf5v9OvwQGhatEsuFk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)