UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qxO0tOra5Nl5hWU2IWMD/oHPrwPjKacLVKM6wtVuUvw='
WHERE
key_id = 'f7e2c23559f9546812f1a72a89e99f93dafc074df1a6fc1f296feefac0f94b96'
AND (
token = 'qxO0tOra5Nl5hWU2IWMD/oHPrwPjKacLVKM6wtVuUvw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)