UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ifVZTuEh+6B2955EyfXE68RIvbbDiuEQWP8/Mi8Tlek='
WHERE
key_id = '346960e47444bbe6bad5436a1be82c8e31551ed5f20cf102a81882026801479c'
AND (
token = 'ifVZTuEh+6B2955EyfXE68RIvbbDiuEQWP8/Mi8Tlek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)