UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bVtN8Zn2Gi86sBZLNIsN20495spnbT2wd5vHXrMqEm8='
WHERE
key_id = '9e7623420f87597b0ada178810c2b78d702647e99067cd891cf1ec5d974d8d43'
AND (
token = 'bVtN8Zn2Gi86sBZLNIsN20495spnbT2wd5vHXrMqEm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)