UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oOOrwGf1SEldiTOpr6+f3Yr+WRBgG//kFCnt7cjmVoM='
WHERE
key_id = '4e5bb299a9549b43e04ea9a83eea58853269889ea36780a805ac6c1de9a83053'
AND (
token = 'oOOrwGf1SEldiTOpr6+f3Yr+WRBgG//kFCnt7cjmVoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)