UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QGt5lQLtkD9daTdxodiRU41KblxcD2PKtcI/PwJ6s+Y='
WHERE
key_id = 'd8cf1e9ceb849490f5a755f6f9b161cafb25e31b4fe5cac33a1909bda5a7eeff'
AND (
token = 'QGt5lQLtkD9daTdxodiRU41KblxcD2PKtcI/PwJ6s+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)