UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'csRCWhhGoildoRKY9MfTrESIHYRkUZWqjGBGa+3xiB8='
WHERE
key_id = '88a4fb12046e67274ae2f9ac2e0ea65aef9b2a4e370468264361dec3d1e49984'
AND (
token = 'csRCWhhGoildoRKY9MfTrESIHYRkUZWqjGBGa+3xiB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)