UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WPUYoT8NLESWAkNX9/kI0o+LhIZblvbIZ3PB3qRCHpw='
WHERE
key_id = 'd02850f41a8212adf89ae799c7c5491abef755fb9bf1b588fad9acc0d142923d'
AND (
token = 'WPUYoT8NLESWAkNX9/kI0o+LhIZblvbIZ3PB3qRCHpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)