UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S+Uynh1pyibF2ECTphCFcnZFUIxTZDhGlz+4Ufb1Zkg='
WHERE
key_id = 'a9dd2f7316ede5e8530b1a2db7aff73df020fd897a080db213e0c8283c408dfc'
AND (
token = 'S+Uynh1pyibF2ECTphCFcnZFUIxTZDhGlz+4Ufb1Zkg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)