UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gHIPTdjj91+jx2THSQDAdAuTL/5Sedp/vRfAjieyPEk='
WHERE
key_id = 'f2e64422fc6d60534b59312348074b566ee9c4af9be393a13328f1ff0f0aca18'
AND (
token = 'gHIPTdjj91+jx2THSQDAdAuTL/5Sedp/vRfAjieyPEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)