UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KgsCNRVOUJD/bPMepN/ccawGG1nDfMnbVZBojo1EPxM='
WHERE
key_id = '9b6236a61c8cd06b3a3e8808a3846da0dd787bb6338f98cdb25d40053287620e'
AND (
token = 'KgsCNRVOUJD/bPMepN/ccawGG1nDfMnbVZBojo1EPxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)