UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWWJ4E7r+9A9XanymT0mMVCO9A9a+N2iIIeIAGDSJu8='
WHERE
key_id = 'f349bd1f046d3a23c4bc2d5314d318d915a5272a17b219edb627c18b25ee3923'
AND (
token = 'KWWJ4E7r+9A9XanymT0mMVCO9A9a+N2iIIeIAGDSJu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)